function getRandomInt (min, max) {
  return Math.floor(Math.random() * (max - min + 1) + min);
}

export function shuffle (array) {
  let arr = array.slice();
  for (let i = 0; i < arr.length; i++) {
    let j = getRandomInt(0, i);
    let t = arr[i];
    arr[i] = arr[j];
    arr[j] = t;
  }
  return arr;
}

export function debunce (func, delay) {
  let timer = null;
  return function (...args) {
    if (timer) {
      clearTimeout(timer);
    }
    timer = setTimeout(function () {
      func.apply(this, args);
    }, delay);
  };
}
